#pragma pack_matrix(row_major)

struct GSOutput
{
	float2 texCoord : TEXCOORD;
	float4 pos : SV_POSITION;
};

cbuffer SCENE: register(b1){
	float4x4 mView;
	float4x4 mProj;
	float4 camPos;
}

cbuffer LIGHT : register(b2){
	float4 color;
	float4 lightPos;
}


[maxvertexcount(4)]
void main(
	point float4 input[1] : SV_POSITION, 
	inout TriangleStream< GSOutput > output
)
{
	float dx = 0.6f;
	float dy = 0.6f;
	float4 lightPosPre = mul(lightPos,mView);
		lightPosPre = mul(lightPosPre,mProj);

	GSOutput quad[4] = {
		{float2(0,1),float4(lightPosPre.x + dx, lightPosPre.y - dy, lightPosPre.z, lightPosPre.w)},
		{float2(1,1),float4(lightPosPre.x - dx, lightPosPre.y - dy, lightPosPre.z, lightPosPre.w)},
		{float2(1,0),float4(lightPosPre.x + dx, lightPosPre.y + dy, lightPosPre.z, lightPosPre.w)},
		{float2(0,0),float4(lightPosPre.x - dx, lightPosPre.y + dy, lightPosPre.z, lightPosPre.w)}
	};

	for(uint i = 0; i < 4; i++)
		output.Append(quad[i]);
	
}